package cn.e3mall.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.e3mall.common.E3Result;
import cn.e3mall.mapper.TbItemParamItemMapper;
import cn.e3mall.pojo.TbItem;
import cn.e3mall.pojo.TbItemParamItem;
import cn.e3mall.pojo.TbItemParamItemExample;
import cn.e3mall.pojo.TbItemParamItemExample.Criteria;
import cn.e3mall.service.ItemParaItemService;

@Service
public class ItemParaItemServiceImpl implements ItemParaItemService {
	
	@Autowired
	private TbItemParamItemMapper tbItemParamItemMapper;

	@Override
	public E3Result getItemParaItemById(Long itemId) {
		TbItemParamItemExample tbItemParamItemExample = new TbItemParamItemExample();
		Criteria criteria = tbItemParamItemExample.createCriteria();
		criteria.andItemIdEqualTo(itemId);
		List<TbItemParamItem> tbItemParamItemList = tbItemParamItemMapper.selectByExample(tbItemParamItemExample);
		if(tbItemParamItemList != null && tbItemParamItemList.size() > 0) {
			return E3Result.ok(tbItemParamItemList);
		}
		return E3Result.ok();
	}

}
